<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增排课规则主')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-courseConfig-add">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">年度：</label>
                    <div class="col-sm-8">
                        <input name="year" class="form-control" type="number" maxlength="4" minlength="4" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">学期：</label>
                    <div class="col-sm-8">
                        <select class='form-control selectpicker' name="semesterId" id="semesterId" th:with="type=${@dict.getType('sc_term_type')}" required>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">年级：</label>
                    <div class="col-sm-8">
                        <select class='form-control selectpicker' id="gradeId" name="gradeId" th:with="type=${@grade.getGradeList()}">
                            <option th:each="grade : ${type}" th:text="${grade.gradeName}" th:value="${grade.id}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">描述：</label>
                    <div class="col-sm-8">
                        <input name="name" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">课数/天：</label>
                    <div class="col-sm-8">
                        <input name="sections" class="form-control" type="number" value="7" required />
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">周数：</label>
                    <div class="col-sm-8">
                        <input name="weeks" class="form-control" type="number" value="1" min="1" max="4" required />
                    </div>
                </div>
            </div>

            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">开始日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            <input name="bgDate" id="bgDate" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">结束日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            <input name="edDate" id="edDate" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "school/courseConfig"
        $("#form-courseConfig-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-courseConfig-add').serialize());
            }
        }
        $("input[name='bgDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            type: 'date',
            autoclose: true
        });
        $("input[name='edDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            type: 'date',
            autoclose: true
        });
    </script>
</body>
</html>